package com.ldzy.signin.controller;

import java.util.HashMap;
import java.util.Map;

import com.ldzy.signin.utlis.QRCodeUtil;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class QRCodeContoller {
    /**
     * 获取二维码图片
     * @return
     */
    @PostMapping("/img")
    public Map<String,Object> getQRCodeImage() {
        Map<String,Object> img=new HashMap<>();
        long timeStamp1 = System.currentTimeMillis();
        String content="http://127.0.0.1:8888/to-sign-in-page/"+timeStamp1;
        System.out.println(content);
        String base64= QRCodeUtil.getImageToBase64(content,  true);
        img.put("img", base64);
        img.put("code",1);

        return img;
    }
}

